<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-on:methods</title>
</head>

<body>
    <div id="app">
        <button @click="fn">切换显示隐藏</button>
        <h1 v-show="isShow">你看不看得见我~</h1>
    </div>
 
    <!-- 引入包-->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                isShow:false
            },
            methods:{
                fn(){
                    //让提供的所有methods中的函数，this都指向当前实例
                    console.log(app===this);
                    app.isShow=!app.isShow
                }
            }
        })
    </script>
</body>

</html>